]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Don't grow indicators more than the parent
authorCarlos Soriano <carlos.soriano89@gmail.com>
Tue, 5 Aug 2014 09:17:32 +0000 (11:17 +0200)
committerCarlos Soriano <carlos.soriano89@gmail.com>
Wed, 6 Aug 2014 07:41:29 +0000 (09:41 +0200)
Currently the indicators are a BoxLayout inside a BinLayout in AllView.
BinLayout doesn't have any size constraint, so if the indicators request
a bigger size than AllView the entire overview is grown, causing the
overview to go crazy.

To avoid that, create an actor for the page indicators that request as
minimum size 0, and as a natural size, the sum of all indicators natural
sizes. Then we clip_to_allocation, so it doesn't grow more than the
parent.

https://bugzilla.gnome.org/show_bug.cgi?id=723496

js/ui/appDisplay.js

index 253d4c40656995eec249ef373359f804a0cabfa7..194905f0bdbdc3bf8850dd50fdc199a787e801e5 100644 (file)
@@ -181,17 +181,35 @@ const BaseAppView = new Lang.Class({
 });
 Signals.addSignalMethods(BaseAppView.prototype);
 
+const PageIndicatorsActor = new Lang.Class({
+    Name:'PageIndicatorsActor',
+    Extends: St.BoxLayout,
+
+    _init: function() {
+        this.parent({ style_class: 'page-indicators',
+                      vertical: true,
+                      x_expand: true, y_expand: true,
+                      x_align: Clutter.ActorAlign.END,
+                      y_align: Clutter.ActorAlign.CENTER,
+                      reactive: true,
+                      clip_to_allocation: true });
+    },
+
+    vfunc_get_preferred_height: function(forWidth) {
+        // We want to request the natural height of all our children as our
+        // natural height, so we chain up to St.BoxLayout, but we only request 0
+        // as minimum height, since it's not that important if some indicators
+        // are not shown
+        let [, natHeight] = this.parent(forWidth);
+        return [0, natHeight];
+    }
+});
 
 const PageIndicators = new Lang.Class({
     Name:'PageIndicators',
 
     _init: function() {
-        this.actor = new St.BoxLayout({ style_class: 'page-indicators',
-                                        vertical: true,
-                                        x_expand: true, y_expand: true,
-                                        x_align: Clutter.ActorAlign.END,
-                                        y_align: Clutter.ActorAlign.CENTER,
-                                        reactive: true });
+        this.actor = new PageIndicatorsActor();
         this._nPages = 0;
         this._currentPage = undefined;